package com.alks.function.controller.biocontrol.webWork;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.biocontrol.webwork.CutLineDto;
import com.alks.function.data.request.finance.fincons.OrderUnitPriceRequest;
import com.alks.function.service.biocontrol.deptwork.ICutLineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@ApiRestController("/schedule/cut/config")
@Api(value = "生控部", tags = "生控部-web查询-冲裁进度配置")
@Slf4j
public class ScheduleCutConfigController {
    @Autowired
    private ICutLineService cutLineService;

    @WebLogger
    @PostMapping("/line/list")
    @ApiOperation(value = "冲裁部门资料定义查询", tags = "生控部-web查询-冲裁进度配置")
    public ResponseInfo list() {
        return cutLineService.list();
    }

    @WebLogger
    @PostMapping("/line/create")
    @ApiOperation(value = "冲裁部门资料定义创建", tags = "生控部-web查询-冲裁进度配置")
    public ResponseInfo add(@RequestBody CutLineDto cutLine) {
        return cutLineService.addStitchLine(cutLine);
    }

    @WebLogger
    @PostMapping("/line/update")
    @ApiOperation(value = "冲裁部门资料定义更新", tags = "生控部-web查询-冲裁进度配置")
    public ResponseInfo update(@RequestBody CutLineDto cutLine) {
        return cutLineService.updateByRowId(cutLine);
    }

    @WebLogger
    @GetMapping("/line/delete")
    @ApiOperation(value = "冲裁部门资料定义删除", tags = "生控部-web查询-冲裁进度配置")
    public ResponseInfo delete(@RequestParam @ApiParam("id")  int id) {
        return cutLineService.deleteCutLineByRowId(id);
    }

}